# Load necessary libraries
library(ggplot2)
library(rnaturalearth)
library(rnaturalearthdata)
library(dplyr)
library(ggrepel)

setwd("")

# Get Africa map data
africa <- ne_countries(scale = "medium", returnclass = "sf", continent = "africa")

# Specify the countries to highlight
countries_to_highlight <- c("Algeria",    "Burkina Faso", "Burundi", "Cameroon", "Côte d'Ivoire", "Egypt", 
                            "Guinea", "Kenya", "Liberia", "Mali", "Morocco", "Mozambique", "Niger", "Nigeria", "Senegal", "Sierra Leone", 
                            "South Africa", "Sudan", "Togo", "Tunisia", "Uganda", "Zimbabwe")

# Create a subset of highlighted countries for labeling
highlighted_countries <- africa[africa$name %in% countries_to_highlight, ]

# Plot the map with only African countries
p <- ggplot(data = africa) +
  geom_sf(fill = "transparent") +  # Set fill color to transparent
  geom_sf(data = highlighted_countries, fill = "#A6CEE3") +
  geom_sf_text(data = highlighted_countries, aes(label = name), size = 6, check_overlap = TRUE) +
  theme_void() +  # Remove all axes and background elements
  labs(title = "") +
  theme(#plot.background = element_rect(fill = "transparent", color = NA),  # Set plot background to transparent
        #panel.background = element_rect(fill = "transparent", color = NA),  # Set panel background to transparent
        axis.title.x = element_blank(),  # Remove x-axis label
        axis.title.y = element_blank())  +  # Remove y-axis label 
      xlim(-19, 58) +  # Set x-axis limits
      ylim(40, -40)    # Set y-axis limits# Remove y-axis label 
print(p)

